import React from 'react';
import { Form, Button, Input, Select } from 'antd';
import { customTrimFunc } from '@/utils/utils.jsx';

const { Option } = Select;

const GoodsSearch = ({ handleOk, handleReset }) => {
  
  const [form] = Form.useForm();

  const onFinish = (val) => {
    handleOk(customTrimFunc(val));
  }

  const onReset = () => {
    handleReset();
		form.resetFields();
  }

  return (
    <Form 
      layout='horizontal' 
      className='search-form-style'
      name='combina-goods-search-com'
      form={form}
      onFinish={onFinish}
    >
      <Form.Item label="组合商品名称" name="composeName">
        <Input placeholder="组合商品名称" />
      </Form.Item>
      <Form.Item label="组合编号" name="code">
        <Input placeholder="组合编号" />
      </Form.Item>
      <Form.Item label="是否有商品下架" name="zjfGoodsState">
        <Select placeholder="请选择">
            <Option value={'1'}>是</Option>
            <Option value={'2'}>否</Option>
        </Select>
      </Form.Item>
      <Form.Item>
        <Button type='primary' htmlType='submit'>查询</Button>
        <Button onClick={onReset} style={{ marginLeft: '12px' }}>重置</Button>
      </Form.Item>
    </Form>
  );
};

export default GoodsSearch;